<template>
  <div>
    <div v-wechat-title="$route.meta.title"></div>

  </div>
</template>
<script>
import wechat from '@/assets/js/wechat.js';// 跳转微信 获取权限

export default {
  data () {
    return {

    }
  },
  methods: {
    vistor () {
      this.$axios.http
        .post({
          funcName: "/fwdj/person/visit",
          params: {
            dwid: sessionStorage.getItem("openId"),
            openId: sessionStorage.getItem("openId"),

          }
        })
        .then(res => {

          if (res && res.code == "200") { //已注册 （已签到  已签退）
            this.$router.push({ name: "visitorRegister" });

          } else if (res && res.code == "500") { //未注册
            this.$router.push({ name: "visitorRegister" });
          } else if (res && res.code == "202") { //已注册 第一次登记(返回已注册对象)
            this.$router.push({ name: "visitorRegister" });
          } else if (res && res.code == "201") { //已注册 （已签到  未签退）
            sessionStorage.setItem("userInfo", JSON.stringify(res.record));

            this.$router.push({ name: "repeteRegister" });

          } else {
            _that.$public.toast(res.msg);
          }
        });
    }
  },
  mounted () {
    let url = window.location.href;
    wechat.wechatLogin(() => {
      this.vistor();
    }, url);

  }

}
</script>
<style lang="stylus" scoped>
</style>


